Skip to content

Add constant folding and lookup function to transform plugin - #1002

Merged
timggggggg merged 2 commits into
masterfrom
999-transform-field-mapping-function
Sep 24, 2026
Merged

timggggggg merged 2 commits into
masterfrom
999-transform-field-mapping-function

Conversation

@timggggggg

Copy link
Copy Markdown
Collaborator

Description

  • add lookup(value, table, default:) — translates a value through an
    object table; keys match by string form, so 0 and "0" are the same key.
    A miss returns the value unchanged unless default: is given.
  • fold constant call arguments and assignment values into core.ConstExpr
    during the validation walk, so a table literal is built once at startup
    instead of per event (70 entries: 7347 -> 1248 ns/op, 88 -> 14 allocs).
    An expression that fails to evaluate is never folded and keeps failing
    at runtime.
  • fix equality against event fields: JSONNodeValue compared String()
    forms, so .obj == {a: 1} could never match. == and != now resolve both
    operands like every other operator. Equality is now type-aware:
    .num == "1" is false where it used to be true.
  • sort object keys in DumpAST

Fixes #999

@timggggggg
timggggggg force-pushed the 999-transform-field-mapping-function branch from 8b24b2e to 3718462 Compare September 23, 2026 14:32
@timggggggg
timggggggg force-pushed the 999-transform-field-mapping-function branch from 3718462 to 8b40863 Compare September 24, 2026 13:04
@timggggggg
timggggggg merged commit 87fa51e into master Sep 24, 2026
22 of 24 checks passed
@timggggggg
timggggggg deleted the 999-transform-field-mapping-function branch September 24, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: transform plugin — translate field values via a configured mapping

3 participants